package com.jandn.common.util;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

public class PramUtil {
	public static Map<String, Object> getModel(HttpServletRequest request){
		Map<String, Object> model = new HashMap<String, Object>();
		Enumeration en = request.getParameterNames();
		while(en.hasMoreElements()){
			String attributeName = (String)en.nextElement();
			model.put(attributeName, request.getParameter(attributeName));
		}
		model.put("userId", request.getSession().getAttribute("userId"));
		return model;
	}
	
	public static Map setPage(Map model){
		if(model.get("pageNo")==null || "".equals(model.get("pageNo"))){
			model.put("pageNo", "1");
		}
		model.put("pageNum","20");
		return model;
	}
}
